package com.yjkf.zh.test.thread;

public class MyYield {
    public static void main(String[] args){
        Thread thread = new Thread(()->{
            for(int x=0;x<10;x++){
                if(x%3==0){
                        Thread.yield();
                }
                System.out.println(Thread.currentThread().getName()+"执行"+x);
            }
        },"副线程");
        thread.start();
        for(int x=0;x<10;x++){
            System.out.println("主线程"+x);
        }
    }
}
